package com.cnebula.dataprocess.sqoop.job.producer;

import javax.annotation.Resource;

import org.apache.rocketmq.spring.starter.core.RocketMQTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.cnebula.dataprocess.common.sqoop.SqoopJobResult;
import com.google.gson.Gson;

@Component
public class SqoopJobProducer {
	
	private static final Logger log = LoggerFactory.getLogger(SqoopJobProducer.class);
	private Gson gson = new Gson();

	@Resource
    private RocketMQTemplate rocketMQTemplate;
	
	public void sendMsg(SqoopJobResult msg){
		log.info("===========================send sqoop job message====================================");
		log.info(gson.toJson(msg));
		rocketMQTemplate.convertAndSend("sqoop-job-topic", msg);
		log.info("=====================================================================================");
	}
}
